
import {get} from "../../untils/db"

Page({
  data:{
  menu:[],
  su:false,
  value:""
  },
  async onLoad(){
    let token =wx.getStorageSync('login')
  let res= await get("/api/tasks-lib/findPage",{},token)
  console.log(res.data.rows);
  this.setData({
    menu:res.data.rows
  })
  },
  change(e){
  this.setData({
    value:e.detail.value
  })
  },


  go(){
    if(this.data.value.length==0){
      wx.showToast({
        title: '请选择任务',
        icon:"none"
      })
    }else{
      let uid=this.data.menu[this.data.value]
      console.log(uid);
      let obj={
        name:uid.name,
        content:uid.content,
        taskLibId:uid.id
      }
      
      wx.setStorageSync('release1', obj)
     
    wx.redirectTo({
      url: '../zguye/zhuye',
    })
    }
  
  }
})